﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace S7.Windows.Employees
{
    /// <summary>
    /// Interaction logic for EditAnEmployee.xaml
    /// </summary>
    public partial class EditAnEmployee : Window
    {
        public EditAnEmployee()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            Employee.currEmp.FirstName = tbFirstName.Text;
            Employee.currEmp.LastName = tbLastName.Text;
            Employee.currEmp.Address = tbAddress.Text;
            Employee.currEmp.Mobile = tbAddress.Text;
            Employee.currEmp.Salary = decimal.Parse(tbSalary.Text);
            Employee.currEmp.EditInfo();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            tbFirstName.Text = Employee.currEmp.FirstName;
            tbLastName.Text = Employee.currEmp.LastName;
            tbAddress.Text = Employee.currEmp.Address;
            tbMobile.Text = Employee.currEmp.Mobile;
            tbSalary.Text = Employee.currEmp.Salary.ToString();
        }
    }
}
